import { reactive, ref } from "vue";
import { defineStore } from "pinia";

export interface IUser {
  UId: string;
  UName: string;
  Token: string;
  StoreId: string;
  TenantId: string;
  IsTenant: boolean;
}

export const loginStore = defineStore("login", {
  state: () => ({
    //userInfo: reactive({} as IUser),
    userInfo: {
      UId: "", //可变
      UName: "",
      Token: "",
      StoreId: 0, //可变
      TenantId: "",
      IsTenant: false,
    },

    isLogin: false, //可变
    setIsLogin(value: boolean) {
      this.isLogin = value;
    },
    setUserInfo(userInfo: IUser) {
      this.userInfo = userInfo;
    },
    getUserInfo() {
      return this.userInfo;
    },
  }),
});
